package com.skycode7.util;

import java.sql.Connection;
import java.sql.DriverManager;

public class DBConnection {
    private String Filename;
    private int DbType;
    private Connection conn;
    private String MysqlDriver;
    private String MysqlURL;
    private DBConnection()
    {
        conn = null;
    }
    public Connection getConn()
    {
        DbType=1;
        switch(DbType)
        {
            case 1:return(getConnToMysql());
            default:return null;
        }
    }
    public Connection getConnToMysql()
    {
        try {
            MysqlDriver = "org.gjt.mm.mysql.Driver";
            MysqlURL = "jdbc:mysql://localhost:3306/skycode7?user=fairchild&password=123456";
            Class.forName(MysqlDriver).newInstance();
            conn = DriverManager.getConnection(MysqlURL);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
        }
    }

